package com.jrx.anytxn.transaction.mapper.ext;

import com.jrx.anytxn.transaction.entity.TlTransactionInfo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 交易mapper扩展
 *
 * @author : zhenghaopu
 * 2019/11/1
 */
public interface ExtTlTransactionInfoMapper {

    /**
     * 批量插入交易信息
     *
     * @param transactionInfos 交易信息列表
     * @return 插入记录数
     */
    int batchInsert(List<TlTransactionInfo> transactionInfos);

    /**
     * 根据订单号及询客户交易信息
     *
     * @param loanId     流水号
     * @param txnCode    交易码
     * @param customerId 客户id
     * @param tenantId   租户id
     * @return 交易参考号
     */
    TlTransactionInfo selectByLoanIdAndTxnCode(String loanId, String txnCode, String customerId, String tenantId);

    List<TlTransactionInfo> selectByCondSelective(@Param("tenantId") String tenantId, @Param("channel") String channel, @Param("customerId") String customerId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    TlTransactionInfo selectTlTransactionInfoByTxnNumber(@Param("customerId") String customerId, @Param("tenantId") String tenantId, @Param("channel") String channel, @Param("txnNumber") String txnNumber);

    TlTransactionInfo selectBySeqNo(@Param("seqNo") String seqNo, @Param("customerId") String customerId, @Param("tenantId") String tenantId);

    TlTransactionInfo selectBySeqNoAndTxnCode(String seqNo, String txnCode, String tenantId);

    int countByBusinessDateAndTxnCode(@Param("tenantId") String tenantId, @Param("businessDate") Date businessDate, @Param("txnCode") String txnCode,@Param("thirdChannel") String thirdChannel);

    BigDecimal sumByBusinessDateAndTxnCode(@Param("tenantId") String tenantId, @Param("businessDate") Date businessDate, @Param("txnCode") String txnCode,@Param("thirdChannel") String thirdChannel);

    List<TlTransactionInfo> selectByPostingDateForBatch(@Param("tenantId") String tenantId, @Param("businessDate") Date businessDate, @Param("txnCode") String txnCode,@Param("thirdChannel") String thirdChannel);

}